package com.example.work.service;

import com.example.work.entity.UserEntity;
import com.example.work.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Description:     UserService服务层
 * Author:         JinMu
 * CreateDate:     2018/2/26 10:54
 * Version:        1.0
 */
@Service
@Transactional
public class UserService {

    @Autowired
    private UserRepository userRepository;

    //添加一条数据
    public void adduser(UserEntity userEntity){
        userRepository.save(userEntity);
    }
    //查询
    public UserEntity queryuser(String name){
    return userRepository.findOne(name);
    }
}